<%@ page contentType="text/html;charset=UTF-8" language="java" %>
<%@taglib prefix="c" uri="http://java.sun.com/jstl/core_rt" %>
<html>
<head>
    <title>JDBC</title>
    <style>
        span {
            color: red;
            font-weight: bold;
            font-size: large;
        }
    </style>

    <script type="text/javascript">
        function gotoPager(pageNum) {
            document.getElementById("pageNum").value = pageNum;
            document.getElementById("query").submit();
        }
    </script>
</head>
<body>
<center>

    <form id="query" action="/student/list.do" method="post">
        学号：<input name="sno" id="sno" value="${student.sno}"> 姓名:<input name="name" id="name" value="${student.name}">
        性别:<select name="sex" id="sex">
        <option value="">==全部==</option>
        <option value="男" ${student.sex=='男'?'selected':''}>男</option>
        <option value="女" ${student.sex=='女'?'selected':''}>女</option>
    </select>
        手机:<input name="phone" id="phone" value="${student.phone}">
        <input id="pageNum" type="hidden" name="pageNum" value="">
        <input type="submit" value="查找">
    </form>
    <table border="1px" width="80%">
        <tr>
            <td><input type="checkbox" id="checkAll" onchange="checkAll()">全选</td>
            <td>学号</td>
            <td>姓名</td>
            <td>性别</td>
            <td>电话</td>
            <td>操作</td>
        </tr>
        <c:forEach items="${page.list}" var="stu">
            <tr>
                <td><input type="checkbox" class='checkIds' value="${stu.id}"></td>
                <td>${stu.sno}</td>
                <td>${stu.name}</td>
                <td>${stu.sex}</td>
                <td>${stu.phone}</td>
                <td>
                    <a href="#">查看</a>|<a href="#">修改</a>|<a href="#">删除</a>
                </td>
            </tr>
        </c:forEach>
    </table>


    <a href="javascript:gotoPager(1)">首页</a>|
    <a href="javascript:gotoPager(${page.pager.pageNum-1<1?1:page.pager.pageNum-1})">上一页</a>|
    <a href="javascript:gotoPager(${page.pager.pageNum+1>page.pager.totalPage?page.pager.totalPage:page.pager.pageNum+1})">下一页</a>|
    <a href="javascript:gotoPager(${page.pager.totalPage})">尾页</a><br>
    当前第<span>${page.pager.pageNum}</span>页，共<span>${page.pager.totalPage}</span>页，共<span>${page.pager.totalNum}</span>条记录

</center>
</body>
</html>
